package utils

import (
	"strings"
	"time"
)

func DateLayout(layout string) string {
	layout = strings.Replace(layout, "Y", "2006", -1)
	layout = strings.Replace(layout, "m", "01", -1)
	layout = strings.Replace(layout, "d", "02", -1)
	layout = strings.Replace(layout, "H", "15", -1)
	layout = strings.Replace(layout, "i", "04", -1)
	layout = strings.Replace(layout, "s", "05", -1)
	return strings.Replace(layout, "u", "999999999", -1)
}

func Date(layout string) string {
	return time.Now().Format(DateLayout(layout))
}
